<template>
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
    <van-swipe-item v-for="item in bannerlist" :key="item.imgSrc">
      <img :src="item.imgSrc" />
    </van-swipe-item>
  </van-swipe>
</template>

<script setup lang="ts">
import type { IBanner } from "../type";
import { ref, onMounted } from "vue";
import { getbanner } from "@/api/mock-home";
const bannerlist = ref<IBanner[]>([]);
onMounted(async () => {
  try {
    let res = await getbanner();
    bannerlist.value = res.data.result;
  } catch (error) {
    console.log(error);
  }
});
</script>
<style scoped lang="less">
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
  height: 150px;
  img {
    display: block;
    width: 100%;
    height: 100%;
  }
}
</style>
